package com.wtoip.core.vo;

import java.io.Serializable;

/**
 * 异步请求返回参数包装类
 * @author llx
 *
 */
public class Result implements Serializable {
	private static final long serialVersionUID = 1L;
	
	//状态：1代表成功，0代表失败。其他代表其他状态
	private String status = "1";
	//提示信息
	private String msg;
	//返回的数据
	private Object data;
	//是否加密：0-不加密，1-加密
	private Integer encrypt = 0;
	
	//构造函数
	public Result() {
		
	}
	
	/**
	 * 带提示信息构造函数
	 * @param status
	 * @param msg
	 */
	public Result(String status, String msg) {
		this.status = status;
		this.msg = msg;
	}
	
	/**
	 * 带数据构造函数
	 * @param status
	 * @param msg
	 * @param data
	 */
	public Result(String status, String msg, Object data) {
		this.status = status;
		this.msg = msg;
		this.data = data;
	}
	
	/**
	 * 设置成功提示
	 * @param msg
	 */
	public void setSuccessMsg(String msg) {
		this.status = "1";
		this.msg = msg;
	}
	
	/**
	 * 设置失败提示
	 * @param msg
	 */
	public void setErrorMsg(String msg) {
		this.status = "0";
		this.msg = msg;
	}
	
	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	public Object getData() {
		return data;
	}

	public void setData(Object data) {
		this.data = data;
	}

	public Integer getEncrypt() {
		return encrypt;
	}

	public void setEncrypt(Integer encrypt) {
		this.encrypt = encrypt;
	}
	
	@Override
	public String toString() {
		StringBuffer sb = new StringBuffer();
		sb.append("{status=").append(status).append(",");
		sb.append("msg=").append(msg).append(",");
		sb.append("encrypt=").append(encrypt).append(",");
		sb.append("data=[").append(data.toString()).append("]}");
		return sb.toString();
	}
}
